import { Navigate } from "react-router-dom";
import React, { lazy } from "react";

import LayoutPage from "@/layout";
import Login from "@/pages/Login";
import Youden from "@/pages/Charts/Youden";
import Youdt from "@/pages/Charts/Youdt";
import Bar from "@/pages/Charts/Bar";
import Column from "@/pages/Charts/Column";
import RepFormat from "@/pages/RepFormat";
import Lots from "@/pages/Lots";
import Quality from "@/pages/Quality";
import BaseMaterial from "@/pages/BaseMaterial";
import Analyte from "@/pages/Analyte";
import InstrReagent from "@/pages/InstrReagent";
import Methodology from "@/pages/Methodology";
import Reports from "@/pages/Reports";
import User from "@/pages/User";
import Role from "@/pages/Role";
import Organization from "@/pages/Organization";
import Add from "@/pages/User/Add";
import Edit from "@/pages/User/Edit";
import MultiAdd from "@/pages/User/MultiAdd";
import AddRole from "@/pages/Role/AddRole";
import EditRole from "@/pages/Role/EditRole";
import AddOrgans from "@/pages/Organization/AddOrgans";
import EditOrgans from "@/pages/Organization/EditOrgans";
import AddUser from "@/pages/Organization/AddUser";
import EditUser from "@/pages/Organization/EditUser";
import Reagent from "@/pages/Reagent";
import AddReagent from "@/pages/Reagent/AddReagent";
import EditReagent from "@/pages/Reagent/EditReagent";
import Error404 from "@/pages/Error/404";

import { AuthRoute } from "@/components/AuthRoute";
import AddAnalyte from "@/pages/Analyte/AddAnalyte";
import EditAnalyte from "@/pages/Analyte/EditAnalyte";
import Labs from "@/pages/Labs";
import Batch from "@/pages/Batch";
import Tests from "@/pages/Tests";
import LJ from "@/pages/Charts/LJ";
import { AppstoreOutlined } from "@ant-design/icons";
import UserList from "@/pages/User/UserList";
import RoleList from "@/pages/Role/RoleList";
import OrganList from "@/pages/Organization/OrganList";

const routes = [
  {
    path: "/login",
    element: <Login />,
  },
  {
    path: "/",
    element: <Navigate to="/laboratory/labs" replace />,
  },
  {
    path: "/laboratory",
    element: <Navigate to="/laboratory/labs" replace />,
  },
  {
    path: "/system",
    element: <Navigate to="/system/lots" replace />,
  },
  {
    path: "/charts",
    element: <Navigate to="/charts/l-j" replace />,
  },
  {
    path: "/reports",
    element: <Navigate to="/reports/data-reports" replace />,
  },
  {
    path: "/",
    label: "首页",
    element: <LayoutPage />,
    children: [
      {
        path: "laboratory/labs",
        label: "实验室",
        element: <Labs />,
      },
      {
        path: "laboratory/batch",
        label: "批管理",
        element: <Batch />,
      },
      {
        path: "laboratory/tests",
        label: "测试管理",
        element: <Tests />,
      },
      {
        path: "charts/l-j",
        label: "L-J图",
        element: <LJ />,
      },
      {
        path: "charts/youden",
        label: "Youden图",
        element: <Youden />,
      },
      {
        path: "charts/youdt",
        label: "Youdt图",
        element: <Youdt />,
      },
      {
        path: "charts/bar",
        label: "柱状图",
        element: <Bar />,
      },
      {
        path: "charts/column",
        label: "条形图",
        element: <Column />,
      },
      {
        path: "reports/data-reports",
        label: "数据报告",
        element: <Reports />,
      },
      {
        path: "system/lots",
        label: "批号管理",
        element: <Lots />,
      },
      {
        path: "system/quality",
        label: "质控品管理",
        element: <Quality />,
      },
      {
        path: "system/base-material",
        label: "基质管理",
        element: <BaseMaterial />,
      },
      {
        path: "system/analyte",
        label: "分析物管理",
        element: <Analyte />,
        children: [
          {
            path: "add-analyte",
            label: "新增分析物",
            element: <AddAnalyte />,
          },
          {
            path: "edit-analyte",
            label: "编辑分析物",
            element: <EditAnalyte />,
          },
        ],
      },
      {
        path: "system/reagent",
        label: "试剂管理",
        element: <Reagent />,
      },
      {
        path: "system/instr-reagent",
        label: "仪器/试剂盒管理",
        element: <InstrReagent />,
      },
      {
        path: "system/methodology",
        label: "方法学",
        element: <Methodology />,
      },
      {
        path: "system/rep-format",
        label: "数据报告格式管理",
        element: <RepFormat />,
      },
      {
        path: "system/user/*",
        label: "用户管理",
        element: <User />,
        children: [
          {
            path: "",
            element: <UserList />,
          },
          {
            path: "add-user",
            element: <Add />,
          },
          {
            path: "edit-user",
            element: <Edit />,
          },
          {
            path: "multi-add",
            element: <MultiAdd />,
          },
        ],
      },
      {
        path: "system/role/*",
        label: "角色管理",
        element: <Role />,
        children: [
          {
            path: "",
            element: <RoleList />,
          },
          {
            path: "add-role",
            element: <AddRole />,
          },
          {
            path: "edit-role",
            element: <EditRole />,
          },
        ],
      },
      {
        path: "system/organization/*",
        label: "组织架构",
        element: <Organization />,
        children: [
          {
            path: "",
            element: <OrganList />,
          },
          {
            path: "add-organization",
            element: <AddOrgans />,
          },
          {
            path: "edit-organization",
            element: <EditOrgans />,
          },
          {
            path: "add-user",
            element: <AddUser />,
          },
          {
            path: "edit-user",
            element: <EditUser />,
          },
        ],
      },
    ],
  },

  {
    path: "*",
    element: <Error404 />,
  },
];

export default routes;
